#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int evalRPN(vector<string>& tokens)
    {
        stack<int> st;
        for (int i = 0;i < tokens.size();++i)
        {
            if (tokens[i] == "+" || tokens[i] == "-" || tokens[i] == "*" || tokens[i] == "/")
            {
                int right = st.top();
                st.pop();
                int left = st.top();
                st.pop();
                int result = 0;
                switch (tokens[i][0])
                {
                case '+':
                    result = left + right;
                    break;
                case '-':
                    result = left - right;
                    break;
                case '*':
                    result = left * right;
                    break;
                case '/':
                    result = left / right;
                    break;
                }
                st.push(result);
            }
            else
            {
                st.push(stoi(tokens[i]));
            }
        }
        return st.top();
    }
};